<?php
class BuynodeController extends NodeController {
	
	public function _routeDown() {
		parent::_routeDown ();
		
		if (! isset ( $_COOKIE [self::COOKIENAME] )) {
			$this->view ()->assign ( "error", "请先登录" );
			$this->view ()->display ( "file:public/error.tpl" );
			exit ();
		
		}
		$flag = false;
		if ($this->_user_global ['manager'] < 3) {
			$flag = true;
		}
		
		if ($this->_user_global ['groupid'] == 11 && $this->_user_global ['verify'] == 1) {
			$flag = true;
		}
		
		if ($this->_user_global ['groupid'] == 14 && $this->_user_global ['verify'] == 1) {
			$flag = true;
		}
		
		if (! $flag) {
			$this->view ()->assign ( "error", "没有权限,请联系管理员才能进入" );
			$this->view ()->display ( "file:public/error.tpl" );
			exit ();
		}
		
		//二次密码
		$this->checkAuthroize ();
	
	}
	
	//授权
	public function authorize() {
		$this->view ()->display ( "file:buy/authorize.tpl" );
		exit ();
	}
	
	

	public function checkAuthroize() {
		if (isset ( $_COOKIE ['jiami'] )) {
			return true;
		} else {
			$this->authorize ();
		}
	}
}